/*
 * EDAS2 - TetraTech, Inc.
 *
 * Distributable under GPL license.
 * See terms of license at gnu.org.
 */
package com.tetratech.edas2.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.hibernate.validator.NotNull;

/**
 * ResultFrequencyClass generated by hbm2java
 */
@Entity
@Table(name = "ED_RESULT_FREQUENCY_CLASS")
public class ResultFrequencyClass extends AttributableUpdateEntity
		implements
			java.io.Serializable {

	private Long uid;
	private FrequencyClassDescriptor frequencyClassDescriptor;
	private Organization organization;
	private MeasurementUnit measurementUnit;
	private Integer lowerBound;
	private Integer upperBound;

	public ResultFrequencyClass() {
	}

	public ResultFrequencyClass(Long uid,
			FrequencyClassDescriptor frequencyClassDescriptor,
			Organization organization) {
		this.uid = uid;
		this.frequencyClassDescriptor = frequencyClassDescriptor;
		this.organization = organization;
	}

	@Id
	@Column(name = "RFCLS_UID", unique = true, nullable = false, precision = 20, scale = 0)
	@GeneratedValue(generator = "ResultFrequencyClassSequence")
	@SequenceGenerator(name = "ResultFrequencyClassSequence", sequenceName = "RFCLS_SEQ", allocationSize = 1)
	//@NotNull
	public Long getUid() {
		return this.uid;
	}

	public void setUid(Long uid) {
		this.uid = uid;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FCDSC_UID", nullable = false)
	@NotNull
	public FrequencyClassDescriptor getFrequencyClassDescriptor() {
		return this.frequencyClassDescriptor;
	}

	public void setFrequencyClassDescriptor(
			FrequencyClassDescriptor frequencyClassDescriptor) {
		this.frequencyClassDescriptor = frequencyClassDescriptor;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ORG_UID", nullable = false)
	@NotNull
	public Organization getOrganization() {
		return this.organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "MSUNT_UID")
	public MeasurementUnit getMeasurementUnit() {
		return this.measurementUnit;
	}

	public void setMeasurementUnit(MeasurementUnit measurementUnit) {
		this.measurementUnit = measurementUnit;
	}

	@Column(name = "FCDSC_LOWER_BOUND", precision = 8, scale = 0)
	public Integer getLowerBound() {
		return this.lowerBound;
	}

	public void setLowerBound(Integer lowerBound) {
		this.lowerBound = lowerBound;
	}

	@Column(name = "FCDSC_UPPER_BOUND", precision = 8, scale = 0)
	public Integer getUpperBound() {
		return this.upperBound;
	}

	public void setUpperBound(Integer upperBound) {
		this.upperBound = upperBound;
	}

	// The following is extra code specified in the hbm.xml files

	private Result result;

	@OneToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "RES_UID", nullable = false)
	@NotNull
	public Result getResult() {
		return this.result;
	}

	public void setResult(Result result) {
		this.result = result;
	}

	// end of extra code specified in the hbm.xml files

}
